package com.learn.rabbitmq.eight.rejection;

import com.learn.rabbitmq.utils.RabbitMqUtils;
import com.rabbitmq.client.Channel;

import java.nio.charset.StandardCharsets;

/**
 * 死信队列
 *
 * 消费者2
 */
public class Consumer02Rejection {

    //死信队列
    public static final String DEAD_QUEUE = "dead_queue";

    public static void main(String[] args) throws Exception {
        Channel channel = RabbitMqUtils.getChannel();
        System.out.println("C2等待接收消息。。。");


        channel.basicConsume(
                DEAD_QUEUE,
                true,
                (consumerTag, message) -> {
                    System.out.println("C2接收的消息是:" + new String(message.getBody(), StandardCharsets.UTF_8));
                },
                consumerTag -> {

                });
    }
}
